package cn.jimmie.learn.viewArt.fragment

import android.view.View
import android.widget.SeekBar
import cn.jimmie.learn.viewArt.R
import cn.jimmie.learn.viewArt.weight.LrcView
import kotlinx.android.synthetic.main.fragment_lrc.view.*

/**
 * function :
 *
 * <p> Create Time: 2019年01月15日 22:56 </p>
 * <p> @author Jimmie.Qian  </p>
 */
class LrcFragment : BaseFragment() {
    override fun layoutId(): Int = R.layout.fragment_lrc

    override fun initView(root: View) {

        root.seekbar.setOnSeekBarChangeListener(object : SeekBar.OnSeekBarChangeListener {
            override fun onStartTrackingTouch(seekBar: SeekBar?) {
            }

            override fun onStopTrackingTouch(seekBar: SeekBar?) {
            }

            override fun onProgressChanged(seekBar: SeekBar, progress: Int, fromUser: Boolean) {
                val pct = 1f * progress / seekBar.max
                root.my_view.pct = pct
            }
        })

        root.btn1.setOnClickListener {
            root.my_view.type = LrcView.TYPE_LAYER
        }

        root.btn2.setOnClickListener {
            root.my_view.type = LrcView.TYPE_CLIP
        }

        root.btn3.setOnClickListener {
            root.my_view.type = LrcView.TYPE_NONE
        }
    }
}